= javascript_include_tag "prototype", "juggernaut", "swfobject.js"
= juggernaut :secret_key=>"ff2c60a805a540a294b609a599bfe78c6c36f123"
= stylesheet_link_tag "chat"
#main
#users
  - if @list_all_user
    - ChatUser.all.each do |u|
      - user= User.find_by_login u.login
      - att = {:title=>"#{user.title}#{user.fname} #{user.lname}", :id=>user.login}
      %div{att}
        = image_tag "user.png"
        = u.login
%p{:style=>"clear:both; padding-top:10px;"}
= form_remote_tag :url=>"/main/chat_broadcast"
ข้อความ:
= text_field_tag "msg", nil, :size=>"50"
= hidden_field_tag "login", @login
= hidden_field_tag "embed", params[:embed]
= submit_tag "ส่งข้อความ"
</form>

%script
  $('msg').focus();
  Element.addMethods({
  appendText: function(element, text) {
  element = $(element);
  newDiv = document.createElement("div");
  newDiv.innerHTML = text;
  element.appendChild(newDiv);
  element.scrollTop = element.scrollHeight;
  $('msg').clear();
  $('msg').focus();
  return element;
  }
  });
